package cn.edu.fzu.homemaking.sso.mapper;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import cn.edu.fzu.homemaking.sso.domain.entity.CompanyUser;
import cn.edu.fzu.homemaking.sso.domain.entity.Customer;
import cn.edu.fzu.homemaking.sso.domain.entity.SysUser;
import cn.edu.fzu.homemaking.sso.domain.entity.User;
import cn.edu.fzu.homemaking.sso.domain.enums.CompanyUserTypeEnum;
import cn.edu.fzu.homemaking.sso.domain.enums.SexEnum;
import cn.edu.fzu.homemaking.sso.domain.enums.StatusEnum;

public interface UserMapper {

    SysUser getSysUserByEmail(@Param("email") String email);


    SysUser getSysUserById(@Param("id") Long id);


    Customer getCustomerByEmail(@Param("email") String email);


    Customer getCustomerById(@Param("id") Long id);


    CompanyUser getCompanyUserByEmail(@Param("email") String email);


    CompanyUser getCompanyUserById(@Param("id") Long id);


    List<User> listAllFace(@Param("fromId") long from, @Param("limit") int limit);


    /** 更新user表 **/
    void updateUser(@Param("id") Long id, @Param("email") String email, @Param("password") String password,
                    @Param("phone") String phone, @Param("address") String address, @Param("faceUrl") String faceUrl,
                    @Param("status") StatusEnum status);


    /** 向 user 表中插入数据 **/
    void insertUser(@Param("user") User user);


    /** 向sys_user表中插入数据 **/
    void insertSysUser(@Param("userId") Long userId);


    List<SysUser> listSysUser(@Param("email") String email, @Param("name") String name, @Param("sex") SexEnum sex,
                              @Param("phone") String phone, @Param("status") StatusEnum status);


    /** 更新company_user表 **/
    void updateCompanyUser(@Param("userId") Long userId, @Param("labelId") Long labelId);


    /** 批量获取顾客信息 **/
    List<Customer> listCustomer(@Param("email") String email, @Param("name") String name, @Param("sex") SexEnum sex,
                                @Param("phone") String phone, @Param("status") StatusEnum status);


    /** 向cus_user表中插入数据 **/
    void insertCustomer(@Param("userId") Long userId);


    /** 批量获取家政人员信息 **/
    List<CompanyUser> listCompanyUser(@Param("email") String email, @Param("name") String name,
                                      @Param("sex") SexEnum sex, @Param("phone") String phone,
                                      @Param("status") StatusEnum status, @Param("companyId") Long companyId,
                                      @Param("type") CompanyUserTypeEnum type, @Param("labelId") Long labelId);


    /** 向company_user 插入数据 **/
    void insertCompanyUser(@Param("userId") Long userId, @Param("companyId") Long companyId,
                           @Param("labelId") Long labelId, @Param("type") CompanyUserTypeEnum type,
                           @Param("salary") BigDecimal salary);


    String getNameByCompanyUserId(@Param("id") Long id);


    String getNameByCustomerId(@Param("id") Long id);

    Long countCustomer();

    Long countCompanyUser();
}
